<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>双选会</title>

    <link rel="stylesheet" href="./css/base.css">
    <link rel="stylesheet" href="css/iconfont.css">

    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">


    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="./js/bootstrap-select.js"></script>
    <link rel="stylesheet" href="./css/index.css">
</head>

<body>
    <div class="container">
        <div class="top">
            <!-- 搜索 -->
            <div class="search-bar">
                <div class="searchform">
                    <div class="input-group">
                        <i class="iconfont my-icon-sousuo"></i>
                        <input type="search" name="data" id="input-search" class="form-control" placeholder="请输入岗位关键词">
                    </div>
                </div>
            </div>
            <div class="filter-bar">
                <form id="Form2" class="form-horizontal" action="www.baidu.com" role="form">
                    <div class="form-group">
                        <div class="select-box">
                            <select id="mySelect" class="selectpicker show-tick form-control">
                                <option value="0">111</option>
                                <option value="1">bull</option>
                                <option value="2">ox</option>
                            </select>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="main">
            <div class="items-list" id="item">
                <!-- 每一个卡片 -->
                <div class="item" id="1">
                    <div class="item-content">
                        <div class="item-left">
                            <p class="item-tite">招聘岗位&nbsp;:&nbsp;cto</p>
                            <p class="item-desc"><span class="type-blue">30000~40000</span>元/月</p>
                            <p class="item-tag">
                                <span>北京市</span>
                                <span> 博士以上学历</span>
                            </p>
                            <p class="item-other"><span
                                    style="margin-right: 1rem;">hr&nbsp;:&nbsp;高经理-人事部123</span><span>招聘总数&nbsp;:&nbsp;2</span>
                            </p>
                        </div>
                        <div class="item-right">
                            <p class="item-values">0/5</p>
                            <p calss="item-name">投递数</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>

</body>
<script>
    var data = [
        {
            list: [
                { id: '1', job: 'name1', salary: 'cont1', site: '北京', edu: '本科', hr: '高经理-人事部', recruit: '2', delivery: '0/3' }
            ]
        }
    ]
    $('#input-search').on('keyup', function (e) {
        if (e.keyCode === 13) {
            var res = data[0].list;//ajax请求
            
            console.log('res: ', res);

            var html = '';
            res.forEach(element => {
                html += ['<div class="items-list" id="item">',
                    '<div class="item" id="' + element.id + '">',
                    '<div class="item-content">',
                    '<div class="item-left">',
                    '<p class="item-tite">招聘岗位&nbsp;:&nbsp;' + element.job + '</p>',
                    '<p class="item-desc"><span class="type-blue">' + element.salary + '</span>元/月</p>',
                    '<p class="item-tag">',
                    '<span>' + element.site + '</span>',
                    '<span>' + element.edu + '</span>',
                    '</p>',
                    '<p class="item-other"><span style="margin-right: 1rem;">hr&nbsp;:&nbsp;' + element.hr + '</span><span>招聘总数&nbsp;:&nbsp;' + element.recruit + '</span>',
                    '</p>',
                    '</div>',
                    '<div class="item-right">',
                    '<p class="item-values">' + element.delivery + '</p>',
                    '<p calss="item-name">投递数</p>',
                    '</div></div></div></div>'
                ].join('');
            });
            $('#item').html(html);

        }
    })
    $("#1").click(function () {
        $(location).attr('href', 'http://www.baidu.com');
    });

    $('#mySelect').on('changed.bs.select', function (e, clickedIndex, isSelected, previousValue) {

        $.ajax({
            //请求方式
            type: "GET",
            //请求地址
            url: "",
            //数据，json字符串
            data: clickedIndex,
            //请求成功
            success: function (res) {

            }

        });
    });


</script>

</html>